@using Microsoft.AspNet.Identity
@model WeatherForecast.Mvc.Models.ManageUserViewModel

<p>You're logged in as <strong>@User.Identity.GetUserName()</strong>.</p>

@using (Html.BeginForm("Manage", "Account"))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary()

    <fieldset class="form-horizontal">
        <legend>Change Password Form</legend>
        <div class="control-group">
            @Html.LabelFor(m => m.OldPassword, new { @class = "control-label" })
            <div class="controls">
                @Html.PasswordFor(m => m.OldPassword)
            </div>
        </div>
        <div class="control-group">
            @Html.LabelFor(m => m.NewPassword, new { @class = "control-label" })
            <div class="controls">
                @Html.PasswordFor(m => m.NewPassword)
            </div>
        </div>
        <div class="control-group">
            @Html.LabelFor(m => m.ConfirmPassword, new { @class = "control-label" })
            <div class="controls">
                @Html.PasswordFor(m => m.ConfirmPassword)
            </div>
        </div>
    </fieldset>
    <fieldset class="form-horizontal">
        <legend>Change User Settings</legend>
        <div class="control-group">
            @Html.LabelFor(m => m.FirstName, new { @class = "control-label" })
            <div class="controls">
                @Html.TextBoxFor(m => m.FirstName, new { @Value = ViewBag.firstName })
            </div>
        </div>
        <div class="control-group">
            @Html.LabelFor(m => m.LastName, new { @class = "control-label" })
            <div class="controls">
                @Html.TextBoxFor(m => m.LastName, new { @Value = ViewBag.lastName })
            </div>
        </div>
        <div class="control-group">
            @Html.LabelFor(m => m.Description, new { @class = "control-label" })
            <div class="controls">
                @Html.TextBoxFor(m => m.Description, new { @Value = ViewBag.description })
            </div>
        </div>
        <div>
            Profile Picture:
            <img src="@(Url.Content("~/img/account/" + ViewBag.picture))" alt="image" style="width:150px; height:200px;">
            @(Html.Kendo()
                                    .Upload()
                                    .Name("upload")
                                    .Multiple(true)
                                    .Async(async =>
                                    {
                                        async.AutoUpload(true)
                                            .Save("UploadedFiles", "Account", new { area = "" });
                                    }))
        </div>

        @if (User.IsInRole("Admin"))
        {
            if (Model.IsAuthor)
            {
                @:<a href='/admin/togle/@Model.Username' class ="btn">Demote Author</a>
            }
            else
            {
                @:<a href='/admin/togle/@Model.Username' class ="btn">Promote Author</a>
            }
        }

        <div class="form-actions no-color">
            <input type="submit" value="Change user settings" class="btn" />
        </div>

    </fieldset>
}
